package com.kaishengit.service;

import java.util.List;

import com.kaishengit.dao.UserDao;
import com.kaishengit.entity.User;
import com.kaishengit.util.StringUtil;

public class UserService {

	private UserDao dao = new UserDao();
	
	public User login(String name,String password) {
		User u = dao.findByName(name);
		
		if(u != null && u.getPassword().equals(StringUtil.sha1(password))) {
			return u;
		}
		return null;
	}

	public List<User> findAll() {
		
		return dao.findAll();
	}
}
